﻿/*****************************************************************
 * Copyright (C) Newegg Corporation. All rights reserved.
 * 
 * Author       :  Bill Li (Bill.S.Li@newegg.com)
 * Create Date  :  
 * Usage        :  
 *
 * RevisionHistory
 * Date         Author               Description
 * 
*****************************************************************/
using System.Xml;
using System.Text;

namespace TemplateEngine.TranslateCommand
{
    internal class BodyTranslate:ITranslate
    {

        public string Translate(TemplateNode node, XmlNode xmlNode)
        {
            StringBuilder html = new StringBuilder();
            html.Append(node.ResultStr);

            foreach (var item in node.Nodes)
            {
                html = html.Replace("{[" + item.NodeGuid.ToString("N") + "]}", item.TranslateNode(xmlNode));
            }
            return html.ToString();
        }

    }
}
